package com.googlecode.continuity.plugin.project.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.googlecode.continuity.core.client.CoreGWT;
import com.googlecode.continuity.core.client.rpc.RPCCreationCallback;

/**
 * ProjectInit
 *
 * @author Peter Schmitt <aragos@aragos.de>
 */
public class ProjectInit implements EntryPoint {
  public void onModuleLoad() {
    //register rpc
    CoreGWT.registerRPC("ProjectRPCAsync", new RPCCreationCallback() {
      public Object createRPC() {
        ProjectRPCAsync projectRPC = (ProjectRPCAsync) GWT.create(ProjectRPC.class);
        ServiceDefTarget endpoint = (ServiceDefTarget) projectRPC;
        String moduleRelativeURL = CoreGWT.getWebappRoot() + "project.rpc";
        endpoint.setServiceEntryPoint(moduleRelativeURL);
        return projectRPC;
      }
    });
  }
}
